home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 June / PCWorld_2001-06_cd.bin / Novinky / unis / Soubory ExcelDB.exe / ExcelDB / Seçity / SQLSERVERMAKRO2.bas < prev    next >
BASIC Source File  |  2001-04-24  |  2KB  |  36 lines

  1. Attribute VB_Name = "Module2"
  2. Sub Makro2()
  3. Attribute Makro2.VB_Description = "Makro zaznamenanΘ 13.4.2001, Pokorn²"
  4. Attribute Makro2.VB_ProcData.VB_Invoke_Func = " \n14"
  5. '
  6. ' Makro2 Makro
  7. ' Makro zaznamenanΘ 13.4.2001, Pokorn²
  8. '
  9.     With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
  10.         "ODBC;DSN=SQL Server - Publikace;Description=Zdroj dat pro p°φstup k databßzi PUBS;SERVER=(local);UID=sa;PWD=;WSID=X8J5U8;DATABASE=pu" _
  11.         ), Array( _
  12.         "bs;LANGUAGE=us_english;OemToAnsi=Yes;TranslationDLL=Yes;QueryLogTime=Yes")), _
  13.         Destination:=Range("A11"))
  14.         .CommandText = Array( _
  15.         "SELECT titleview.au_lname, authors.au_fname, titleview.title, titleview.au_ord, authors.address, authors.city, titleview.price, authors.zip, authors.state, titleview.ytd_sales, titleview.pub_id, publi" _
  16.         , _
  17.         "shers.pub_name" & Chr(13) & "" & Chr(10) & "FROM pubs.dbo.authors authors, pubs.dbo.publishers publishers, pubs.dbo.titleview titleview" & Chr(13) & "" & Chr(10) & "WHERE publishers.pub_id = titleview.pub_id AND authors.au_lname = titleview.au_lname" & Chr(13) & "" & Chr(10) & "ORDER" _
  18.         , " BY titleview.au_lname, authors.au_fname")
  19.         .Name = "Dotaz z SQL Server - Publikace"
  20.         .FieldNames = True
  21.         .RowNumbers = False
  22.         .FillAdjacentFormulas = False
  23.         .PreserveFormatting = True
  24.         .RefreshOnFileOpen = False
  25.         .BackgroundQuery = True
  26.         .RefreshStyle = xlInsertDeleteCells
  27.         .SavePassword = True
  28.         .SaveData = True
  29.         .AdjustColumnWidth = True
  30.         .RefreshPeriod = 0
  31.         .PreserveColumnInfo = True
  32.         .Refresh BackgroundQuery:=False
  33.     End With
  34.  
  35. End Sub
  36.